import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from time import sleep
@pytest.fixture()
def log_print():
    print("开启曰志")
    yield
    print("关闭曰志")

@pytest.fixture()
def database_clean(log_print):
    print("链接数据库,清理数据库的内容")
    yield
    print("断开数据库的链接")


@pytest.fixture()
def get_driver(database_clean):
    driver = webdriver.Chrome()
    print("打开浏览器")
    # 隐式等待:在等待时间内整个页面完成加载,则执行代码,否则抛出异常
    # driver.implicitlu wait(10)#
    driver.get("http://localhost/ranzhi/www")
    yield driver  # yield 相当于 return
    # teardown
    driver.quit()
    print("关闭浏览器")
def test001(get_driver):
    print("执行ui测试代码")
